from flask import Flask, jsonify
from app.api import login_blue

app = Flask(__name__)

app.register_blueprint(login_blue)


@app.errorhandler(Exception)
def server_error(error):
    response = dict(message=str(error))
    if hasattr(error, 'code'):  # 判断异常对象是否有code属性
        status_code = error.code  # 获取状态码
    else:
        status_code = 500
    return jsonify(response), status_code


@app.route('/')
def hello_world():
    return 'index'




if __name__ == '__main__':
    app.run(port=5000)